#include"headfile.h"

//用于查询学生操作
char name_login[N] = {0},
     id_login[N] = {0},
     passwd_login[N] = {0};
//用于删除学生操作
char name_delete[N];
int mistake = 0, //密码错误输入次数
    maxlen = 1; //堆排序数组最大长度，可动态扩容

int main()
{
#if 0

    FILE * fp = fopen("./document/user.txt","w");
    for(int i = 0; i < 6; i++)
    {
        member mem = {0,0,0,0,0};
        printf("请输入 id号 姓名 密码:");
        scanf("%d %s %s",&mem.id,mem.name,mem.password);
        fprintf(fp,"%20d%20s%20s\n",mem.id,mem.name,mem.password);
    }
    fclose(fp);
#else
    while(1)
    {
        system("clear");
        function(login_num);
    }
#endif
#if 0
    short number,
          num = getLine("./document/student.txt"); //获取文件中存储学生的个数
    FILE * fp = fopen("./document/student.txt","r+"); //以读写形式打开文件
    studentNode * p = initNode();
    for(int i = 0; i < num; i++) //将文件中存储的学生的信息放到链表中
    {
        student s;
        fscanf(fp,"%s %s %hd %hd",
            s.name,s.sex,&(s.age),&(s.id));
        tailAdd(p,getStu(s));
    }
    printf("已存在的学生:%d个\n",num);
    traverse(p);

    printf("------\n请输入要输入的学生个数:");
    scanf("%hd%*c",&number);
    if(number)
    {
        create(fp, p, number); //给要输入的每个学生输入信息并且存储在链表中
        traverse(p);
        stuAdd(fp, p); //将链表中存储的所有数据放入文件中
    }
    fclose(fp);
#endif

    return 0;
}

